{% extends "base.html" %}
{% block title %}月份考核汇总{% endblock %}
{% block user %}{% endblock %}
{% block navbar %}{{ super() }}{% endblock %}

{% block scripts %}{{ super() }}

<script>
    $(document).ready(function () {
        $('#dt').DataTable(
            {
                "autoWidth": true,
                "pageLength": 25,
                dom: '<"top"flipB<"clear">>rt<"bottom"ipB<"clear">>',
                "order": [[2, "asc"], [0, "asc"]],
                buttons: [
                    'copy', 'csv', 'excel'
                ]
            });
    });
</script>
{% endblock %}
{% block content %}
<div class="container">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            {% include 'flash_message.html' %}
        </div>


        <h2 class="row page-header" style="text-align: center; color:blueviolet;">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                <a class="btn btn-success" href="
                {% if month== 1 %}
                    {{url_for('bp_assess.score_list',year=year-1,month=12)}}
                {% else %}
                    {{url_for('bp_assess.score_list',year=year,month=month-1)}}
                {% endif %}            
                
                ">上月</a>
                {{ year }} 年 {{ month }} 月 考核汇总表
                <a class="btn btn-success" href="              
                
                {% if month== 12 %}
                    {{url_for('bp_assess.score_list',year=year+1,month=1)}}
                {% else %}
                    {{url_for('bp_assess.score_list',year=year,month=month+1)}}
                {% endif %}        
                ">下月</a>
            </div>
        </h2>
        <h3 class="row" style="text-align: center; color:rgb(233, 58, 15);">
            <div>
                本月标准工时 {{ stdworkdays[1]}} 小时 ({{ stdworkdays[0] }} 天)
            </div>
        </h3>
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <table id="dt" class="row-border hover compact table" style="width:100%">
                <thead>
                    <tr>
                        {% for field in fields[1:]%}
                        <th>{{ field }} </th>
                        {% endfor %}

                    </tr>
                </thead>
                <tbody>
                    {% for user in users %}
                    <tr>
                        {% for i in range(1, user.__len__()) %}
                        {% if i > 0 %}
                        {% if i == 2  %}
                        <td><a href="{{ url_for('bp_partner.calendar', user_id=user[0]) }}"> {{ user[2] }} </td>
                        {% elif i ==  5 %}
                        {% if user[5] != None%}
                        <td><a
                                href="{{ url_for('bp_assess.user_project_grade', user_id=user[0], year=year, month=month) }}">
                                {{user[5].__int__()}}
                            </a></td>
                        {% else %}
                        <td> None </td>
                        {% endif%}

                        {% elif i > 5 %}

                        {% if user[i] > 0 %}
                        <td>
                            <!-- style="background-color: skyblue;"> -->
                            {% if i == 8  %}
                            <a
                                href="{{ url_for('bp_assess.user_offwork_detail', user_id=user[0], year=year, month=month) }}">
                                {{ user[i].__int__() }}
                            </a>
                            {% else %}
                            {{ user[i].__int__() }}
                            {% endif %}
                        </td>
                        {% else %}
                        <td>
                            {{user[i].__int__()}}
                        </td>
                        {% endif %}

                        {% else %}
                        <td>{{ user[i] }}</td>
                        {% endif %}
                        {% endif %}
                        {% endfor %}

                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}